Skip to content

test: fix vacuous assertions in src/fuzzy_schedule.rs#1512

Merged
jamesadevine merged 1 commit into
mainfrom
test-reducer/fuzzy-schedule-2026-07-14-5318d1d5eaec898c
Jul 15, 2026
Merged

test: fix vacuous assertions in src/fuzzy_schedule.rs#1512
jamesadevine merged 1 commit into
mainfrom
test-reducer/fuzzy-schedule-2026-07-14-5318d1d5eaec898c

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: src/fuzzy_schedule.rs

What was wrong

  • test_parse_hourly: body was a single matches! check on a unit enum variant. It confirmed the keyword "hourly" parses to FuzzySchedule::Hourly, but made no assertion about the cron expression that variant produces. A regression that changed the cron format (e.g. replacing the scattered minute with a fixed 0, or adding an extra field) would pass undetected.

  • test_parse_special_periods: same pattern — two matches! checks confirmed "bi-weekly" and "tri-weekly" parse to their respective variants, but never verified the cron step values (*/14 / */21) or the scattered minute/hour bounds. Swapping the two steps, or emitting a fixed 0 instead of a hash-scattered value, would not be caught.

Changes

Test Action Reason
test_parse_hourly Rewritten Added 5-field cron structure check, minute-in-[0,59] bounds check, and * * * * wildcard assertions
test_parse_special_periods Rewritten Added */14 / */21 step assertions and scattered minute/hour range checks for both variants

Verification

  • cargo test -- fuzzy_schedule: all 18 tests pass ✅
  • No other test suites affected ✅

Generated by Test Reducer · 64.9 AIC · ⌖ 12.1 AIC · ⊞ 8.7K ·

Rewrite two low-value tests that only checked enum discriminants
via matches! without verifying the cron expressions they generate:

- test_parse_hourly: add cron structure assertions (5 fields,
  scattered minute in [0,59], correct * wildcards for hourly)
- test_parse_special_periods: add cron step assertions (*/14 for
  bi-weekly, */21 for tri-weekly) plus bounds checks on the
  scattered minute/hour values

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine jamesadevine marked this pull request as ready for review July 15, 2026 09:47
@jamesadevine jamesadevine merged commit fc0674c into main Jul 15, 2026
21 checks passed
@jamesadevine jamesadevine deleted the test-reducer/fuzzy-schedule-2026-07-14-5318d1d5eaec898c branch July 15, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant